<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://localhost" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://localhost" elementFormDefault="qualified">
  <xs:element name="provider">
    <xs:annotation>
			<xs:documentation xml:lang="ro">Structura datelor de personalizare pentru aplicaţiile de raportare pentru medicii cu convenţii de eliberare a certificatelor medicale</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="addresses">
          <xs:annotation>
            <xs:documentation xml:lang="ro">Lista de adrese ale furnizorului</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="address" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation xml:lang="ro">Adresa cabinetului medical</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:attribute name="cityCode" type="xs:string" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Localitatea (valoarea codului din nomenclatorul de localităţi)</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="districtCode" type="xs:string" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Judeţul (valoarea codului din nomenclatorul de judeţe)</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="streetName" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numele străzii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="streetNo" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul străzii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="building" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Blocul / Clădirea</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="entrance" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Scara / Intrarea</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="floor" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Etajul</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="apartment" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Apartamentul / Camera</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="postalCode" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Codul poştal</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="employees">
          <xs:annotation>
            <xs:documentation xml:lang="ro">Lista de angajaţi (medici şi asistenţi)</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="employee" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation xml:lang="ro">Datele de identificare ale angajatului</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="specialities" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation xml:lang="ro">Lista specialităţilor angajatului</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="speciality" minOccurs="0" maxOccurs="unbounded">
                            <xs:annotation>
                              <xs:documentation xml:lang="ro">Specialitatea angajatului, dacă acesta este medic</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:attribute name="code" use="required">
                                <xs:annotation>
                                  <xs:documentation xml:lang="ro">Codul din nomenclatorul de specialităţi medicale</xs:documentation>
                                </xs:annotation>
                                <xs:simpleType>
                                  <xs:restriction base="xs:string">
                                    <xs:maxLength value="20" />
                                  </xs:restriction>
                                </xs:simpleType>
                              </xs:attribute>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="pid" type="pidType" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">CNP</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="firstName" type="xs:string" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Prenumele persoanei</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="lastName" type="xs:string" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numele de familie persoanei</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="validFrom" type="xs:date" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data de inceput a valabilităţii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="validTo" type="xs:date" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data de sfârşit a valabilităţii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="stencilNo" type="xs:string" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Codul de parafă al medicului</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="conventions">
          <xs:annotation>
            <xs:documentation xml:lang="ro">Lista de convenţii de eliberare de certificate medicale</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="convention" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                  <xs:documentation xml:lang="ro">Datele convenţiei</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="physicians">
                      <xs:annotation>
                        <xs:documentation xml:lang="ro">Lista medicilor de pe convenţie</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="physician" minOccurs="0" maxOccurs="unbounded">
                            <xs:annotation>
                              <xs:documentation xml:lang="ro">Datele medicului</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:attribute name="stencilNo" type="xs:string" use="required">
                                <xs:annotation>
                                  <xs:documentation xml:lang="ro">Codul de parafă al medicului</xs:documentation>
                                </xs:annotation>
                              </xs:attribute>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="conventionNo" type="xs:string" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Numărul convenţiei</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="conventionDate" type="xs:date" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data de încheiere a convenţiei</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="validFrom" type="xs:date" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data de inceput a valabilităţii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="validTo" type="xs:date" use="optional">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Data de sfârşit a valabilităţii</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                  <xs:attribute name="orgUnitCode" type="xs:string" use="required">
                    <xs:annotation>
                      <xs:documentation xml:lang="ro">Casa de asigurări cu care s-a încheiat contractul (valoarea codului din nomenclatorul de case de asigurări)</xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <!-- header attributes -->
      <xs:attribute name="code" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Codul de identificare unic al furnizorului în SIUI</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="name" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Denumirea furnizorului</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="uic" type="xs:string" use="required">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Codul unic de identificare al furnizorului (cod fiscal)</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="uicDate" type="xs:date" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Data de eliberare a codului unic de identificare</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="regNo" type="xs:string" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Numărul de înregistrare la Registrul Comerţului</xs:documentation>
        </xs:annotation>
      </xs:attribute>
      <xs:attribute name="regNoDate" type="xs:date" use="optional">
        <xs:annotation>
          <xs:documentation xml:lang="ro">Data înregistrării la Registrul Comerţului</xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:simpleType name="pidType">
    <xs:annotation>
      <xs:documentation xml:lang="ro">Definitia tipului de date folosit pentru CNP</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:maxLength value="13" />
      <xs:minLength value="13" />
      <xs:pattern value="[0-9]{13}" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>